import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;

public class LinkedHashSetTest {
    public static void main(String[] args) {
        LinkedHashSet linkedHashSet = new LinkedHashSet();
        linkedHashSet.add("aaa");
        linkedHashSet.add("bbb");
        linkedHashSet.add("ccc");
        linkedHashSet.add("ccc");
        linkedHashSet.add("ccc");
        linkedHashSet.add("ddd");

        //通过遍历看出，是有序且不重复的
        Iterator it = linkedHashSet.iterator();
        while (it.hasNext()){
            System.out.println(it.next());
        }
    }
}
